package org.javaboy.vhr.controller.system;

import org.javaboy.vhr.model.OpLog;
import org.javaboy.vhr.model.RespBean;
import org.javaboy.vhr.service.OpLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/oplog")
public class OpLogController {
        @Autowired
        private OpLogService opLogService;

        @GetMapping("/")
        public List<OpLog> getAllOpLog() {
            List<OpLog> allOpLog = opLogService.getAllOpLog();
            for (OpLog opLog : allOpLog) {

            }
            return opLogService.getAllOpLog();
        }

        @DeleteMapping("/{id}")
        public RespBean deleteByPrimaryKey(@PathVariable Integer id) {

            if (opLogService.deleteByPrimaryKey(id) == 1) {
                return RespBean.ok("删除成功!");
            }
            return RespBean.error("删除失败!");
        }

        @GetMapping("/{id}")
        public OpLog selectByPrimaryKey(@PathVariable Integer id) {
            return opLogService.selectByPrimaryKey(id);
        }


}


